import matplotlib.pyplot as plt
import matplotlib.image as mpimg
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

image_positions = {
    "part1": [
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/产品销量.png", "pos": [0.05, 0.55, 0.4, 0.3]},
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/成本.png", "pos": [0.05, 0.1, 0.49, 0.40]},
    ],
    "part2": [
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/月同比增长.png", "pos": [0.30, 0.60, 0.42, 0.22]},
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/利润率.png", "pos": [0.30, 0.10, 0.5, 0.40]},
    ],
    "part3": [
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/各月销售额.png", "pos": [0.65, 0.6, 0.30, 0.25]},
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/各区域销量.png", "pos": [0.65, 0.37, 0.25, 0.2]},
        {"path": r"D:\python charm\01\可视化\销售看板参考/图片/各快递公司销量.png", "pos": [0.65, 0.11, 0.25, 0.2]},
    ],
}

# 创建主布局
fig = plt.figure(figsize=(40, 15), facecolor="#2E4057")

# 绘制每张图片
for part, images in image_positions.items():
    for image_info in images:
        ax = fig.add_axes(image_info["pos"])
        img = mpimg.imread(image_info["path"])
        ax.imshow(img)
        ax.axis("off")

# 添加主标题
fig.suptitle("公司销售数据可视化看板", fontsize=40, color="white", y=0.95)

plt.savefig(r'D:\python charm\01\可视化\销售看板参考\图片\看板.png')

# 显示图表
plt.show()